
<div class="left-col">
	<div class="title fsize17"><?= $co_product['titlemenu'.$hg] ?></div>
	
	<ul class="pl-list">
		<?php
		$re_list = $db->select("select * from product_cat where level = 1 order by orderId asc");
		while($tt_list = $db->fetch($re_list))
		{
		?>
		<li class="">
                    <a href="<?=APPLICATION_URL?>product/<?=$tt_list['titleurl']?>.html"><?=$tt_list['title'.$hg]?></a>
                    
                    <ul>
                        <?php
                        $re_list2 = $db->select("select * from product_cat where level = 2 and parentid=".$tt_list['id']." order by orderId asc");
                        while($tt_list2 = $db->fetch($re_list2))
                        {
                        ?>
                        <li class="">
                            <a href="<?=APPLICATION_URL?>product/<?=$tt_list2['titleurl']?>.html"><?=$tt_list2['title'.$hg]?></a>
                            <ul>
                                <?php
                                $re_list3 = $db->select("select * from product_cat where level = 3 and parentid=".$tt_list2['id']." order by orderId asc");
                                while($tt_list3 = $db->fetch($re_list3))
                                {
                                ?>
                                <li class="">
                                    <a href="<?=APPLICATION_URL?>product/<?=$tt_list3['titleurl']?>.html"><?=$tt_list3['title'.$hg]?></a>
                                </li>
                                <?php } ?>
                                
                            </ul>
                        </li>
                        
                        <?php } ?>
                    </ul>
		</li>
		<?php
		}
		?>
		
	</ul>
</div>
<div class="right-col">
	<div class="title"><?php __("Search results") ?></div>
	<ul class="pro-items search">
		<?php			
		$i = 0;					
		include_once "library/paging.cls.php";
		$paging=new paging();
		$curpg = $_GET['var3'];
		$curpg=(isset($curpg))?$curpg:1;	
		$gotopage  = APPLICATION_URL."search-result/".$_GET['var2'];					
		$perpage = 9;
		$pagecount = 10;
                
		$k = $_GET['var2'];
                $where_list = " where title like '%$k%' or title_vn like '%$k%' or content like '%$k%' or content_vn like '%$k%' or description like '%$k%' or description_vn like '%$k%'";
		$sql = "select * from product_item $where_list  ";
		
		$query = $db->select($sql);	
		$totalrows=$db->numrows($query);	
		$sql_list = "select * from product_item $where_list order by orderId asc, id asc limit ".(($curpg-1)*$perpage).", ".$perpage;	
		$qr_list = $db->select($sql_list);	
		$num_list = $db->numrows($qr_list);
		if ($num_list > 0) {					
			while($tt_list = $db->fetch($qr_list))
			{ 
				$i++;
				if(($i - 1)%3 == 1)
					$margin = 'class="pro-margin"';
				else
					$margin = "";
			?>
				<li <?= $margin; ?>>
					<div class="pro-item-ctn">
						<!--<a href="<?=APPLICATION_URL?>product-detail/<?=$tt_cat['titleurl']?>/<?=$tt_list['titleurl']?>.html"><img alt="" src="<?=APPLICATION_URL?>product-img/list/<?=$tt_list['image']?>"></a>-->
						<a href="<?=APPLICATION_URL?>product-detail/<?=$tt_list['titleurl']?>.html"><img alt="" src="<?=APPLICATION_URL?>product-img/list/<?=$tt_list['image']?>"></a>
                                                <!--<div class="name"><a href="<?=APPLICATION_URL?>product-detail/<?=$tt_cat['titleurl']?>/<?=$tt_list['titleurl']?>.html"><?=$tt_list['title'.$hg]?></a></div>-->
                                                <div class="name"><a href="<?=APPLICATION_URL?>product-detail/<?=$tt_list['titleurl']?>.html"><?=$tt_list['title'.$hg]?></a></div>
						<!--<div class="home-right-bg"><?= formatPrice($tt_list['price']); ?></div>-->
					</div>
				</li>
		<?php
			}
		}else{
                    
			if ($hg) { //Tiếng Việt
				echo 'Không có sản phẩm nào trong thể loại này';
			}else{
				echo 'No product in this category';
			}
		}
		?>
		
	</ul>
	<div class="clear"></div>
	<div class="paging"><?php echo $paging->pagenew($totalrows, $perpage, $pagecount, $curpg, $gotopage, "","titlepage");?></div>
</div>
